package com.game.net;


import com.game.protobuf.ProtobufMessage;

@ProtobufMessage
public class NetAddress {
    private String host;

    private int port;

    public NetAddress() {}

    public NetAddress(String host, int port) {
        this.host = host;
        this.port = port;
    }

    public String getHost() {
        return this.host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return this.port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String toString() {
        return "[host=" + this.host + ", port=" + this.port + "]";
    }

    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        NetAddress that = (NetAddress)o;
        if (this.port != that.port)
            return false;
        return (this.host != null) ? this.host.equals(that.host) : ((that.host == null));
    }

    public int hashCode() {
        int result = (this.host != null) ? this.host.hashCode() : 0;
        result = 31 * result + this.port;
        return result;
    }
}